package com.stylefeng.guns.core.util;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.core.common.constant.Const;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.modular.borrowing.service.ICustomerinfoService;
import com.stylefeng.guns.modular.system.model.Customerinfo;
import com.stylefeng.guns.modular.system.model.Dept;
import com.stylefeng.guns.modular.system.model.Dict;
import com.stylefeng.guns.modular.system.service.IDeptService;

import java.util.List;


/**
 * 获取字典信息
 */
public class CustomerinfoUtil {

    ICustomerinfoService iCustomerinfoService =SpringContextHolder.getBean(ICustomerinfoService.class);

    /**
     * 根据字典code和字典中的值获取对应的名称
     */
    public String getCustomeryPlatform() {
        StringBuffer html = new StringBuffer();
        html.append("<option value=''>-请选择-</option>\r\n");
        //组装查询
        Wrapper<Customerinfo> wrapper = new EntityWrapper<>();
        wrapper = wrapper.eq("platform", ShiroKit.getUser().getDeptcode());
        List<Customerinfo> dicts = iCustomerinfoService.selectList(wrapper);
        for (Customerinfo item : dicts) {
            html.append("<option value=\""+item.getCustomercode()+"\">"+item.getCustomername()+"</option>\r\n");
        }
        return html.toString();
        }
}
